package org.zfes.snowier.xyz.analysis.analysers;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zfes.snowier.common.chains.handler.HandlerAdapter;
import org.zfes.snowier.common.chains.handler.HandlerEntry;
import org.zfes.snowier.common.chains.session.ISession;

import org.zfes.snowier.zbss.xzy.mo.dtos.IBaseMDto;
import org.zfes.snowier.zbss.xzy.mo.dtos.StatusCode;

public class FaultHandler  extends HandlerAdapter{

	private static final Logger logger = LoggerFactory.getLogger(FaultHandler.class);
	
	@Override
	protected void doHandleExcute(ISession session, Object data, HandlerEntry entry) {
		
		logger.info("-FaultHandler-before-doHandleExcute---data:{}",data);
		
		IBaseMDto mdto= (IBaseMDto)data;
		if(!StatusCode.st_ok.equals(mdto.getSt())) {
			
			logger.info("-FaultHandler-device-status--abnormal---st:{}",mdto.getSt());
		}
		try {
			callAlert( data);
		}catch (Exception e) {
			logger.error("-FaultHandler-callAlert-error:",e);
		}
		
		
	}
	
	private void callAlert(Object data) {
		logger.info("-FaultHandler-callAlert---st:{}");
	}

}
